package CommonEvent;

import io.appium.java_client.android.AndroidDriver;
import static Utils.MyLogger.logInfo;
/**
 * @author 锄禾
 * @projectName MkPack
 * @description: TODO
 */
public class MonkeyBackEvent extends MonkeyEvent {
    private AndroidDriver androidDriver;

    public MonkeyBackEvent(AndroidDriver driver){
        super(MonkeyEvent.EVENT_TYPE_BACK);
        androidDriver = driver;
    }
    /**
    　* @author 锄禾
    　* @description: TODO
    　* @param
    　* @return
    　*/
    public int injectEvent() {
        try {
            androidDriver.navigate().back();
            logInfo("点击返回完成！");
            return MonkeyEvent.INJECT_SUCCESS;
        }catch (Exception E){
            logInfo(this.getClass() + "-" + "点击返回事件异常：" + E);
            return INJECT_FIAL;
        }

    }
}